package com.xm.service.background;

import com.xm.dao.background.CommodityInsuranceDao;
import com.xm.entity.CommodityInsurance;

import java.util.List;

/**
 * 商品规格
 * @author 康文程
 * @date 2024-1-10 下午 12:31
 */
public class CommodityInsuranceService {
    private final CommodityInsuranceDao dao = new CommodityInsuranceDao();
    /**
     * 根据commodity_id查询商品保险
     *
     * @param commodityId 商品ID
     * @return 商品保险列表
     */
    public List<CommodityInsurance> getCommodityInsuranceByCommodityId(Integer commodityId) {
        return dao.getCommodityInsuranceByCommodityId(commodityId);
    }
    /**
     * 新增商品保险
     *
     * @param commodityInsurance 要新增的商品保险对象
     * @return 新增成功的记录数
     */
    public int addCommodityInsurance(CommodityInsurance commodityInsurance) {
        return dao.addCommodityInsurance(commodityInsurance);
    }
    /**
     * 根据commodity_id和insurance_id删除商品保险
     *
     * @param commodityId 商品ID
     * @param insuranceId 商品保险ID
     * @return 删除成功的记录数
     */
    public int deleteCommodityInsuranceByCommodityIdAndInsuranceId(Integer commodityId, Integer insuranceId) {
        return dao.deleteCommodityInsuranceByCommodityIdAndInsuranceId(commodityId, insuranceId);
    }
}
